/**
 * Created by zzy on 2017/9/12.
 */
import React, {Component} from 'react';
import {
    Text,
    View,
    StyleSheet,
    Dimensions
} from 'react-native';
import Modal from 'react-native-modalbox';
import Contant from "../Contant";
let {width} = Dimensions.get('window');

export default class DialogModal extends Component{
    render(){
        let {totalUsed,callbcak}=this.props;
        return <Modal
            position="bottom"
            ref={"dialogModal"}
            backButtonClose={true}
            isOpen={false}
            style={{
                backgroundColor:'rgba(0,0,0,0)',
                alignItems:'center',
                justifyContent:'center'
            }}
        >
       <View style={{alignItems:'center',borderRadius:8,backgroundColor:'white',width:width-60}}>
           <View style={{height:100,justifyContent:'center'}}>
             <Text style={{fontSize:16}}>需支付{totalUsed}张水票，是否确认支付？</Text>
           </View>
           <View style={{backgroundColor:Contant.SEPLINECOLOR,height:StyleSheet.hairlineWidth,width:width-60,overflow:'hidden'}}></View>
           <View style={{flexDirection:'row',alignItems:'center',paddingVertical:10}}>
               <Text style={{flex:1,textAlign:'center',fontSize:16}} onPress={()=>{
                    this.closeModal();
               }}>取消</Text>
               <Text style={{color:'#489EFC',flex:1,textAlign:'center',fontSize:16}} onPress={()=>{
                   callbcak();
                   this.closeModal();
               }}>确认</Text>
           </View>
       </View>
        </Modal>
    }

    openModal(){
        this.refs.dialogModal.open();
    }
    closeModal(){
        this.refs.dialogModal.close();
    }
}